Skip to content

fix(lsp): timeout write to prevent hang when LSP server stdin is full#16114

Open
JayZenith wants to merge 1 commit intoanomalyco:devfrom
JayZenith:fix/lsp-write-timeout
Open

fix(lsp): timeout write to prevent hang when LSP server stdin is full#16114
JayZenith wants to merge 1 commit intoanomalyco:devfrom
JayZenith:fix/lsp-write-timeout

Conversation

@JayZenith
Copy link

@JayZenith JayZenith commented Mar 5, 2026

Issue for this PR

Closes #16115

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

After a large patch, pyright saturates the CPU and stops reading its stdin. The pipe buffer fills and the next write in LSP.touchFile blocks indefinitely, freezing the UI completely.

Wraps the write in withTimeout(3s) so we move on if the LSP isn't responsive.

How did you verify your code works?

20 iterations of large patch and immediate whitespace follow-up against the exact file that triggered the original hang. Zero freezes, zero timeouts.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI freezes indefinitely when applying patches while pyright is CPU-saturated

1 participant